﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGsHlBranchMultimoduleReactor : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGsHlBranchMultimoduleReactor(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGsHlBranchMultimoduleReactor obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGsHlBranchMultimoduleReactor()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGsHlBranchMultimoduleReactor(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public static void attach(OdGsHlBranch pHlBranch, IntPtr pModule, SWIGTYPE_p_OdGsHlBranchReactor pReactor)
		{
			GlobalsPINVOKE.OdGsHlBranchMultimoduleReactor_attach(OdGsHlBranch.getCPtr(pHlBranch), pModule, SWIGTYPE_p_OdGsHlBranchReactor.getCPtr(pReactor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static void detach(OdGsHlBranch pHlBranch, IntPtr pModule)
		{
			GlobalsPINVOKE.OdGsHlBranchMultimoduleReactor_detach(OdGsHlBranch.getCPtr(pHlBranch), pModule);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static SWIGTYPE_p_OdGsHlBranchReactor getReactor(OdGsHlBranch pHlBranch, IntPtr pModule)
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGsHlBranchMultimoduleReactor_getReactor(OdGsHlBranch.getCPtr(pHlBranch), pModule);
			SWIGTYPE_p_OdGsHlBranchReactor result = (intPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_OdGsHlBranchReactor(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static void setReactor(OdGsHlBranch pHlBranch, IntPtr pModule, SWIGTYPE_p_OdGsHlBranchReactor pReactor)
		{
			GlobalsPINVOKE.OdGsHlBranchMultimoduleReactor_setReactor(OdGsHlBranch.getCPtr(pHlBranch), pModule, SWIGTYPE_p_OdGsHlBranchReactor.getCPtr(pReactor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGsHlBranchMultimoduleReactor() : this(GlobalsPINVOKE.new_OdGsHlBranchMultimoduleReactor(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
